package database

import (
	"cache-go/interface/redis"
	"strings"
)

type Server struct {
	db *DB
}

func (server *Server) Exec(c redis.Connection, cmdLine [][]byte) redis.Reply {
	cmdName := strings.ToLower(string(cmdLine[0]))
	if cmdName == "ping" {
		return Ping(c, cmdLine[1:])
	}
	return server.db.Exec(c, cmdLine)
}

func NewStandaloneServer() *Server {
	server := &Server{}
	return server
}

func AfterClientClose(c redis.Connection) {
}

func (s *Server) Close() {
}
